package com.mq.batch.consumer2;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ytj
 * @date 2024/1/15
 */
@Component
@RabbitListener(queues = Demo6Message.QUEUE_NAME,containerFactory = "consumerBatchContainerFactory")
public class Demo6Consumer {

    @RabbitHandler
    public void message(List<Demo6Message> list){
        System.out.println("获取批量消息总数:"+list.size());
        for (Demo6Message demo6Message : list) {
            System.out.println("获取批量消息为:"+demo6Message.getId());
        }
    }


}
